package com.ubi.app.demo;

import com.ubi.app.demo.request.DemoRequest;
import com.ubi.app.demo.response.DemoResponse;
import com.ubi.core.framework.exception.BusinessException;
import com.ubi.core.json.JsonConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 标题、简要说明. <br>
 * 类详细说明.
 * <p>
 * Copyright: Copyright (c) 2017年02月20日 8:47
 * <p>
 * Company:
 * <p>
 *
 * @author Kent
 * @version 1.0.0
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private JsonConverter jsonConverter;


    @RequestMapping(value = "/print", method = RequestMethod.POST)
    public DemoResponse print(@RequestBody DemoRequest request) {

        return new DemoResponse(request.getName());
    }


    @RequestMapping(value = "/exception", method = RequestMethod.GET)
    public void exception() {
        throw new BusinessException("user.password.incorrect");
    }
}
